<% if controller.action_name != 'list_versions' %>
<p class="title">
    <%= path(@folder, false) %>
    &nbsp;
<% if @logged_in_user.is_admin? %>
    <a href="#" onclick="ShowProperties();" class="small" id="rights_link"><%= 'permissions'.t %></a>
    <a href="#" onclick="ShowList();" class="small" id="list_link" style="display:none;"><%= 'back to folder'.t %></a>
<% end %>
    <%= link_to 'RSS', { :controller => 'folder', :action => 'feed', :id => controller.folder_id, :access_key => @logged_in_user.rss_access_key }, { :class => 'small' } %><%= link_to '(!)', { :controller => 'folder', :action => 'feed_warning' }, { :class => 'small', :style => 'margin-left:1px;' } %>
</p>
<% end %>
<div id="list" style="position:relative;"><div>

<% if flash[:folder_error] %>
    <div id="error"><%= flash[:folder_error] %></div>
<% end %>
  <form action="/folder/file_set/<%= @folder.id %>" method="post">
  <input class="imgbut" type="image" alt="Ignore" src="/images/transparent.gif" name="DoNothing" />
    <table class="grid">
        <tr>
            <th></th>
            <th width="*"><%= link_order 'Name'.t, 'name' %></th>
            <th width="10%"><%= link_order 'Size'.t, 'filesize' %></th>
            <th width="10%"><%= link_order 'Date Modified'.t, 'date_modified' %></th>
            <th width="24"></th>
            <th width="24"></th>
            <th width="24"></th>
            <th width="24"></th>
        </tr>
<% if @folder_up %>
        <tr class="<%= cycle('even', 'odd') %>">
            <td><%= image_tag('arrow_up.png') %></td>
            <td><%= @folder_up %></td>
            <td>--</td>
            <td>--</td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
<% end %>
<% @folders.each do |folder| %>
        <tr class="<%= cycle('even', 'odd') %>">
            <td style="white-space:nowrap;"><%= check_box('ftarget',folder.id,{:class => 'checkbox', :title => 'Click to check this item'.t})%><%= image_tag('folder.png') %></td>
            <td><%= link_to h(folder.name), :action => 'list', :id => folder %>
            <%= '<br />' + tags_of(folder) if folder.tag_list.length > 0 %></td>
            <td>--</td>
    <td><%= folder.date_modified.localize('%A %d %B %Y ore %H:%M') %></td>
            <td>
    <% if @can_update %>
                <%= link_to image_tag('edit.png'), { :action => 'rename', :id => folder}, { :title => 'Rename this folder'.t } %>
    <% end %>
            </td>
            <td>
    <% if @can_delete %>
                <input class="imgbut" type="image" src="/images/delete.png" alt="<%= 'Delete this folder'.t %>" name="fdelete[<%= folder.id.to_s %>][]" title="<%= 'Delete this folder'.t %>" onclick="return(confirm('<%= "All files and subfolders will be deleted!".t %>'))" />
    <% end %>
            </td>
            <td></td>
        </tr>
<% end %>
  <% @myfiles.each do |myfile| %>
          <tr class="<%= cycle('even', 'odd') %>">
              <td style="white-space:nowrap;"><%= check_box('target',myfile.id,{:class => 'checkbox', :title => 'Click to check this item'.t})%><%= myfile.thumbnailed ? image_tag(myfile.thumb_url) : image_tag('file.png')%></td>
              <td>
              <%= link_to h(myfile.filename), :controller => 'file', :action => 'download', :id => myfile %>
              <%= ' Rev:' + myfile.version.to_s if @show_version_no %>
              <%= '<br />' + tags_of(myfile) if myfile.tag_list.length > 0 %></td>
              <td><%= myfile.filesize %> KB</td>
      <td><%= myfile.date_modified.localize('%A %d %B %Y ore %H:%M') %></td>
              <td>
      <% if @can_update %>
                  <%= link_to image_tag('edit.png'), { :controller => 'file', :action => 'rename', :id => myfile }, { :title => "Edit file properties like name, tags&hellip;".t } %>
      <% end %>
              </td>
              <td>
      <% if @can_delete %>
                  <input class="imgbut" type="image" src="/images/delete.png" alt="<%= 'Delete'.t %>" name="delete[<%= myfile.id.to_s %>][]" title="<%= 'Delete this file'.t %>" onclick="return(confirm('<%='Are you sure?'.t %>'))" />
      <% end %>
              </td>
              <td>
      <% if myfile.indexed %>
                  <%= link_to image_tag('zoom.png'), { :controller => 'file', :action => 'preview', :id => myfile }, { :title => 'Preview'.t, :class => 'noBackground' } %>
      <% end %>
              </td>
              <td>
      <% if  mimetype=INDEX_MIMETYPES[File.extname(myfile.filename).downcase] %>
      <%= link_to image_tag('inline_image.png'), { :controller => 'file', :action => 'open_inline', :id => myfile, :mimetype => mimetype }, {:title => 'Open in browser'.t} %>
      <% end %>
              </td>
          </tr>
<% end %>
<% unless (@myfiles.empty? && @folders.empty?) %>
          <tr>
              <td colspan="8">
                  <%= 'Actions on multiple items:'.t %><br />
                  <%= select('operation','action',[['Select an operation'.t,''],['Add tags to'.t,'tag'],['Remove tags from'.t,'untag'],['Move'.t,'move'],['Delete'.t,'destroy']],{}, {:onchange => 'argfieldsfor(this.value)'}) %>
                  <%= select('operation','fileset',[['checked items'.t,'1'],['unchecked items'.t,'0']]) %>
                  <%= text_field 'operation','arg_list',{:onkeypress => 'return event.keyCode!=13'} %>
                  <%= select('move','dest_id',@dest_options) %>
                  <%= hidden_field 'operation','return_to', :value => @folder.id %>
                  <input type="submit" value="<%= 'Proceed'.t %>" onclick="return(confirm('<%='Are you sure?'.t %>'))"/><br />
              </td>
          </tr>
<% else %>
          <%= '<tr><td colspan="8"><i>' + 'No files or folders here'.t + '</i></td></tr>' if @folders.empty? %>
<% end %>
    </table>
  </form>

</div></div>

<% reset_cycle %>
<% if @logged_in_user.is_admin? %>
<div id="folder_rights" style="display:none;position:relative;"><div>
    <% form_tag :action => 'update_permissions', :id => params[:id] do %>
        <table>
            <tr>
                <th></th>
                <th></th>
                <th class="rights"><%= 'Create'.t %></th>
                <th class="rights"><%= 'Read'.t %></th>
                <th class="rights"><%= 'Update'.t %></th>
                <th class="rights"><%= 'Delete'.t %></th>
            </tr>
    <% Group.find(:all, :order => 'name').each do |group| %>
            <tr class="<%= cycle('even', 'odd') %>">
        <% disabled = group.is_the_administrators_group? %>
        <% if disabled %>
                <td><%= image_tag('group_grey.png') %></td>
                <td style="color:#818181;"><%= h(group.name) %></td>
        <% else %>
                <td><%= image_tag('group.png') %></td>
                <td><%= h(group.name) %></td>
        <% end %>
                <td class="rights"><%= CRUD_check_box('create', group.id, controller.folder_id, disabled) %></td>
                <td class="rights"><%= CRUD_check_box('read', group.id, controller.folder_id, disabled) %></td>
                <td class="rights"><%= CRUD_check_box('update', group.id, controller.folder_id, disabled) %></td>
                <td class="rights"><%= CRUD_check_box('delete', group.id, controller.folder_id, disabled) %></td>
            </tr>
    <% end %>
        </table>
        <br />
        <%= submit_tag 'Save'.t %> <%= check_box('update_recursively', 'checked', {}, 'yes', 'no') %> <%= 'Apply changes to subfolders'.t %>
    <% end %>
</div></div>
<% end %>